
#ifndef RTERRORNETWORK_H
#define RTERRORNETWORK_H

#include "RtError.h"

enum {
	RT_ERROR_NETWORK_SOCKET_ERROR = RT_ERROR_MODULE_NETWORK + 1, 
	RT_ERROR_NETWORK_SOCKET_RESET,
	RT_ERROR_NETWORK_SOCKET_CLOSE,
	RT_ERROR_NETWORK_SOCKET_BIND_ERROR,
	RT_ERROR_NETWORK_CONNECT_ERROR,
	RT_ERROR_NETWORK_CONNECT_TIMEOUT,
	RT_ERROR_NETWORK_DNS_FAILURE,
	RT_ERROR_NETWORK_PROXY_SERVER_UNAVAILABLE,
	RT_ERROR_NETWORK_UNKNOWN_ERROR,
	RT_ERROR_NETWORK_NO_SERVICE,

	///////////For protocol tp Service/////////////
	RT_ERROR_NETWORK_CONNECTION_RECONNECT, 
	RT_ERROR_NETWORK_CONNECTION_RECONNECT_FAILED, 
	RT_ERROR_NETWORK_CONNECTION_WRONG_TYPE, 
	RT_ERROR_NETWORK_ABATE_CONNECTION,
	RT_ERROR_NETWORK_DENY_ERROR,

	RT_ERROR_NETWORK_INVALID_SYNC = RT_ERROR_MODULE_NETWORK + 20,
	RT_ERROR_NETWORK_INVALID_HANDSHAKE,
	RT_ERROR_NETWORK_PEER_CLOSE_CONNECTION,
	RT_ERROR_NETWORK_PEER_REJECT_CONNECTION,
	RT_ERROR_NETWORK_CONNECTION_LOST,
	RT_ERROR_NETWORK_INVALID_PDU,
	RT_ERROR_NETWORK_CHANNEL_NOT_AVAILABLE,
	RT_ERROR_NETWORK_TICKET_NOT_MATCH,
};


#define RT_OPT_TRANSPORT_BASE			100

//Param. is Pointer to DWORD
//IO Read len
#define RT_OPT_TRANSPORT_FIO_NREAD		(RT_OPT_TRANSPORT_BASE+1)

//Param. is Pointer to DWORD
//Transport unread len
#define RT_OPT_TRANSPORT_TRAN_NREAD		(RT_OPT_TRANSPORT_BASE+2)

//Param. is Pointer to RT_HANDLE
//Get fd
#define RT_OPT_TRANSPORT_FD				(RT_OPT_TRANSPORT_BASE+3)

//Param. is Pointer to CInetAddr
//Get address socket binded
#define RT_OPT_TRANSPORT_LOCAL_ADDR		(RT_OPT_TRANSPORT_BASE+4)

//Param. is Pointer to CInetAddr
//Get peer addr
#define RT_OPT_TRANSPORT_PEER_ADDR		(RT_OPT_TRANSPORT_BASE+5)

//If the socket is still alive
//Param. is Pointer to BOOL
#define RT_OPT_TRANSPORT_SOCK_ALIVE		(RT_OPT_TRANSPORT_BASE+6)

//Param. is Pointer to DWORD
//TYPE_TCP, TYPE_UDP, TYPE_SSL...
#define RT_OPT_TRANSPORT_TRAN_TYPE 		(RT_OPT_TRANSPORT_BASE+7)

//Param. is Pointer to DWORD
#define RT_OPT_TRANSPORT_TCP_KEEPALIVE	(RT_OPT_TRANSPORT_BASE+8)

//Param. is Pointer to DWORD
#define RT_OPT_TRANSPORT_RCV_BUF_LEN	(RT_OPT_TRANSPORT_BASE+9)

//Param. is Pointer to DWORD
#define RT_OPT_TRANSPORT_SND_BUF_LEN 	(RT_OPT_TRANSPORT_BASE+10)

//Param. is Pointer to CRtMessageBlock*, 
//send some user data in the connect request
#define RT_OPT_CONNECTION_CONNCET_DATA 	(RT_OPT_TRANSPORT_BASE+11)

//Param. is Pointer to IRtTransport** ,
//get lower transport, for class CRtTransportThreadProxy
#define RT_OPT_LOWER_TRANSPORT	 		(RT_OPT_TRANSPORT_BASE+12)

//Param. is Pointer to int ,
//for DSCP setting, Type of Service (TOS) settings.
#define RT_OPT_TRANSPORT_TOS	 		(RT_OPT_TRANSPORT_BASE+13)

//Param. is Pointer to DWORD
//setting for MTU size, in bytes.
#define RT_OPT_TRANSPORT_MTU	 		(RT_OPT_TRANSPORT_BASE+14)

//Param. is Pointer to class CRtRudpStatistics
//Get statistics for RUDP connection.
#define RT_OPT_RUDP_STATISTICS	 		(RT_OPT_TRANSPORT_BASE+15)

#define RT_OPT_OBSERVER	 				(RT_OPT_TRANSPORT_BASE+16)

//Param. is Pointer to DWORD
#define RT_OPT_TRANSPORT_TCP_KEEPINTVL	(RT_OPT_TRANSPORT_BASE+17)

//Param. is Pointer to DWORD
#define RT_OPT_TRANSPORT_TCP_KEEPCNT	(RT_OPT_TRANSPORT_BASE+18)

///////////For Connection Service/////////////
//Param. is Pointer to BOOL
#define CS_OPT_NEED_KEEPALIVE			(RT_OPT_TRANSPORT_BASE+31)

//Param. is Pointer to DWORD
#define CS_OPT_MAX_SENDBUF_LEN			(RT_OPT_TRANSPORT_BASE+32)

//Param. is Pointer to BOOL
#define CS_OPT_PKG_NEED_BUF				(RT_OPT_TRANSPORT_BASE+33)

//Param. is Pointer to WORD (Seconds)
#define CS_OPT_KEEPALIVE_INTERVAL		(RT_OPT_TRANSPORT_BASE+34)
//Param. is Pointer to BOOL 
#define CS_OPT_DISABLE_RCVDATA_FLAG		(RT_OPT_TRANSPORT_BASE+35)

//Param. is for connection abate overflow time, WORD
#define CS_OPT_ABATE_TIME				(RT_OPT_TRANSPORT_BASE+36)

//Param. is for connection reconnect overflow time, WORD
#define CS_OPT_RECONNECT_TIME			(RT_OPT_TRANSPORT_BASE+37)

//Param. inquire the RTT, BOOL
#define CS_OPT_DETECT_RTT				(RT_OPT_TRANSPORT_BASE+38)
//Param. inquire the RTT
#define CS_OPT_INQUIRE_RTT				(RT_OPT_TRANSPORT_BASE+39)
/***********Jobs Add at 2008.06.03 for flow control************************/
#define CS_OPT_RECV_RATE				(RT_OPT_TRANSPORT_BASE+40)
#define CS_OPT_SEND_RATE				(RT_OPT_TRANSPORT_BASE+41)
#define CS_OPT_SET_BANDWIDTH				(RT_OPT_TRANSPORT_BASE+42)

/***********Jobs Add at 2008.06.03 end************************/


//////////////////////////////////////////////

/// for channel
#define RT_OPT_CHANNEL_BASE				200

//Param. is Pointer to BOOL
#define RT_OPT_CHANNEL_FILE_SYNC		(RT_OPT_CHANNEL_BASE + 101)

//Param. is Pointer to BOOL
#define RT_OPT_CHANNEL_HTTP_HEADER_CUSTOM_CONTENT_LENGTH	(RT_OPT_CHANNEL_BASE + 111)

//Param. is Pointer to BOOL
#define RT_OPT_CHANNEL_HTTP_PARSER_SKIP_CONTENT_LENGTH	(RT_OPT_CHANNEL_BASE + 112)

//Param. is Pointer to BOOL
#define	RT_OPT_CHANNEL_HTTP_STREAM						(RT_OPT_CHANNEL_BASE + 113)

//Param. is Pointer to LONG
#define	RT_OPT_CHANNEL_HTTP_MAX_CONTENT_LENGTH			(RT_OPT_CHANNEL_BASE + 114)

#endif // RTERRORNETWORK_H
